import os

from common.common import getLog
from log.log import Logger
from config.config import test_case_path
from test_case.test_cases import ExcelExcute
log = getLog('../log/log.ini')
excelPaths = []
file_name_list = os.walk(test_case_path, topdown=True)
for path, dir, files in file_name_list:
    try:
        for file in files:

            if os.path.splitext(file)[1] == '.xlsx':
                excelPath = os.path.join(path, file)
                excelPaths.append(excelPath)
            else:
                Logger().log().info("该文件{}非.xlsx后缀".format(file))

        for excelPath in excelPaths:
            ExcelExcute().excute(excelPath, log)
    except Exception as e:
        Logger().log().error("获取excel数据失败，失败信息：{}".format(e))
